package com.leyou.item.mapper;

import com.leyou.common.mapper.BaseMapper;
import com.leyou.item.pojo.Brand;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface BrandMapper extends BaseMapper<Brand> {

    @Insert("  INSERT INTO tb_category_brand (category_id, brand_id) values (#{cid}, #{bid})")
    int insertCategoryBrand(@Param("cid")Long cid, @Param("bid") Long bid);

    @Select("SELECT b.* FROM TB_BRAND INNER JOIN TB_CATEGORY_BRAND CB ON B.ID = CB.BRAND_ID WHERE CB.CATEGORY_ID = #{CID}")
    List<Brand> queryBrandByCid(@Param("cid") Long cid);
}
